package com.wanxi.service.impl;

import com.wanxi.dao.CuisineDao;
import com.wanxi.dao.impl.CuisineDaoImpl;
import com.wanxi.dto.ResultDTO;
import com.wanxi.model.CuisineModel;
import com.wanxi.service.CuisineService;

import java.util.List;

public class CuisineServiceImpl implements CuisineService {
    private CuisineDao cuisineDao = new CuisineDaoImpl();

    @Override
    public ResultDTO add(CuisineModel cuisineModel) {
        return ResultDTO.builder()
                .msg("")
                .code(0)
                .data("")
                .count(cuisineDao.add(cuisineModel))
                .build();
    }

    @Override
    public ResultDTO update(CuisineModel cuisineModel) {
        return ResultDTO.builder()
                .msg("")
                .code(0)
                .data("")
                .count(cuisineDao.update(cuisineModel))
                .build();
    }

    @Override
    public ResultDTO delete(CuisineModel cuisineModel) {
        return ResultDTO.builder()
                .msg("")
                .code(0)
                .data("")
                .count(cuisineDao.delete(cuisineModel))
                .build();
    }

    @Override
    public ResultDTO findById(CuisineModel cuisineModel) {
        return ResultDTO.builder()
                .msg("")
                .code(0)
                .count(0)
                .data(cuisineDao.findById(cuisineModel))
                .build();
    }

    @Override
    public ResultDTO findAll(CuisineModel cuisineModel) {
        return ResultDTO.builder()
                .msg("")
                .code(0)
                .count(cuisineDao.count(cuisineModel))
                .data(cuisineDao.findAll(cuisineModel))
                .build();
    }
}
